package top.yueyazhui.dds.datasource;

/**
 * 这个类用来存储当前线程所使用的数据源名称
 */
public class DynamicDataSourceContextHolder {

    private static ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>();

    public static void setDataSource(String dataSource) {
        CONTEXT_HOLDER.set(dataSource);
    }

    public static String getDataSource() {
        return CONTEXT_HOLDER.get();
    }

    public static void removeDataSource() {
        CONTEXT_HOLDER.remove();
    }

}
